﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using KPIS.GERP.GHRMS.BLL;
using KPIS.GERP.GHRMS.IBLL;
using KPIS.GERP.GHRMS.MODEL;
using Telerik.Web.UI;
using System.Globalization;
using System.Web.UI.HtmlControls;

namespace KPIS.GERP.GHRMS.APP.App_UI.Forms
{
    public partial class DC_CmdCommitteeDtls : System.Web.UI.Page
    {
        private SsMng ssMng = new SsMng();
        private CommandDisciplineBLL dBLL = new CommandDisciplineBLL();
        protected void Page_Load(object sender, EventArgs e)
        {
            IncludeJava();
            if (!IsPostBack)
            {
                //Session["CMD_GROUP"] = "";//Request.QueryString["grp"].ToString();
                LoadDataGrid();
            }

        }
        public void IncludeJava()
        {
            HtmlGenericControl script = new HtmlGenericControl();
            script.TagName = "script";
            script.Attributes.Add("type", "text/javascript");
            script.Attributes.Add("src", "../../Scripts/jsfunction.js");
            Page.Header.Controls.Add(script);
        }
        private void LoadDataGrid()
        {
            try
            {
                DataTable dt = null;
                dt = dBLL.SelectCommittee(Convert.ToInt32(Request.QueryString["ParSequence"].ToString()));

                RadGrid1.DataSource = dt;
                RadGrid1.DataBind();
            }
            catch (Exception ex)
            {

            }
        }

        protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {

            if (e.CommandName == "btnClick")
            {
                return;
            }

            if (e.CommandName == "Delete")
            {
                int seq = Convert.ToInt32((e.Item as GridDataItem).OwnerTableView.DataKeyValues[e.Item.ItemIndex]["cmd_dtls_seq"]);
                dBLL.DeleteCommittee(seq, ssMng.EmpSeqI);
            }
            LoadDataGrid();
        }
    }
}
